/*
 * Copyright (c) Jack魏 2023 - 2024, All Rights Reserved.
 */

package cn.jackwei.yiyi.controller.sys;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.jackwei.yiyi.service.FileService;
import cn.jackwei.yiyi.util.Result;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件管理控制类
 *
 * @author Jack魏
 * @since 2023/11/19 17:58
 */
@Slf4j
@Validated
@SaCheckLogin
@RestController
@RequestMapping("/file")
@Tag(name = "文件管理", description = "文件管理接口")
public class FileController {
    @Resource
    private FileService fileService;

    /**
     * 多文件上传
     *
     * @param files 文件
     * @return 上传结果
     */
    @PostMapping("/upload")
    public Result<String> upload(@RequestParam("files") MultipartFile[] files) {
        return fileService.upload(files);
    }
}
